public class t55 {
    //55. 跳跃游戏 中等
    public static void main(String[] args) {
        int nums[] = {3,2,1,0,4};
        System.out.println(canJump(nums));
    }

    public static boolean canJump(int[] nums) {
        int len = nums.length;
        boolean dp[] = new boolean[len];
        dp[0] = true;
        for(int i = 1;i<len;i++){
            dp[i] = false;
            for(int j = 0;j<i;j++){
                if(nums[j]>=i-j&&dp[i-1]){
                    dp[i] = true;
                    break;
                }
            }
        }
        return dp[len-1];
    }
}
